// 蜂窝蜜造平台生成代码，如手工更改，请添加到 .beeignore 忽略生成
package com.fowo.api.pda.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fowo.api.common.model.*;
import com.fowo.api.common.util.ResponseUtils;
import com.fowo.api.model.inventory.list.*;
import com.fowo.api.service.InventoryListService;
import com.fowo.api.sys.entity.SysFile;
import com.fowo.api.user.model.JwtUserInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.StreamUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@Tag(name = "PDA库存盘点")
@RequestMapping("/api/pda/Inventorycounting")
@RestController
public class PdaInventoryListController {

  @Resource
  private InventoryListService service;
  @Resource
  private InventoryListSubmitAction inventoryListSubmitAction;

  @Operation(summary = "获取详情")
  @GetMapping("{id}")
  public R<InventoryListVo> getVoById(@PathVariable Long id) {
    return R.data(() -> service.getVoById(id));
  }



//  @PreAuthorize("@am.canAccess('inventoryListEdit')")
  @Operation(summary = "更新")
  @PutMapping
  public R update(@RequestBody InventoryListVo model) {
    return R.run(() -> service.update(model));
  }


  @Operation(summary = "盘点中")
  @GetMapping("inventorying")
  public R<List<InventoryListItemVo>> inventorying(
    InventoryListSearchParamPo search
  ) {
    return R.data(() -> service.inventorying(search));
  }

  @Operation(summary = "盘点中分页")
  @GetMapping("inventoryingPage")
  public R<Page<InventoryListItemVo>> inventoryingPage(
    InventoryListSearchParamPo search
  ) {
    return R.data(() -> service.inventoryingPage(search));
  }

  @Operation(summary = "提交")
  @PostMapping("submit")
  public R submit(@RequestBody IdPo po) {
    return R.run(() -> service.submit(po.getId()));
  }

}
